package com.ruoyi.common.core.domain;

import com.alibaba.fastjson2.JSON;
import com.google.gson.JsonObject;

public class GTPush {


    private int code;

    private String msg;

    private Object data;

    public static String create(int code)
    {
        return restResult(null, code, "操作成功");
    }

    public static String create(int code, Object data)
    {
        return restResult(data, code, "操作成功");
    }

    public static String create(int code, String message)
    {
        return restResult(null, code, message);
    }

    public static String create(int code, Object data,String message)
    {
        return restResult(data, code, message);
    }

    private static String restResult(Object data, int code, String msg)
    {
        GTPush apiResult = new GTPush();
        apiResult.setCode(code);
        apiResult.setData(data);
        apiResult.setMsg(msg);
        return JSON.toJSONString(apiResult);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
